package com.woniu.product.app.apiImpl;

import cn.hutool.core.bean.BeanUtil;
import com.woniu.product.client.CategoryManageClient;
import com.woniu.product.client.param.AddCategoryParam;
import com.woniu.product.service.CategoryService;
import com.woniu.product.service.form.AddCategoryForm;
import com.woniu.result.Result;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class CategoryManageApiImpl implements CategoryManageClient {
    @Resource
    private CategoryService categoryService;
    @Override
    public Result addCategory(AddCategoryParam addCategoryParam) {
        AddCategoryForm addCategoryForm = BeanUtil.copyProperties(addCategoryParam, AddCategoryForm.class);
        return categoryService.addCategory(addCategoryForm);
    }

    @Override
    public Result delCategory(Integer categoryId) {
        return categoryService.deleteCategory(categoryId);
    }

}
